from PySide2.QtWidgets import QMainWindow
from forms.uipy.UI_HomeWindow import Ui_HomeWindow
from forms.uipyimpl.EleHouseVisitRecordsImpl import EleHouseVisitRecordsImpl
from forms.uipyimpl.MEleFileSelected import MEleFileSelected
from forms.uipyimpl.ExcelFindUserImpl import ExcelFindUserImpl
from forms.uipyimpl.IndexFindImpl import IndexFindImpl
from tools.File_Select_Tools import File_Select_Tools
from  forms.uipyimpl.RationalUpCalImpl import RationalUpCalImpl

class HomeWindowImpl(QMainWindow, Ui_HomeWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        # 绑定 工具  ==> 电子记账汇总
        self.m_ele_situation.triggered.connect(lambda: self.m_tools_triggered(0))
        # 绑定  工具 ==> 访户记录
        self.m_house_record.triggered.connect(lambda: self.m_tools_triggered(1))
        # 绑定  工具 ==> Excel 查找用户
        self.m_excel_find_user.triggered.connect(lambda: self.m_tools_triggered(2))
        # 绑定  审核  ===> 市民化审核
        self.m_urbanization_review.triggered.connect(lambda: self.m_tools_triggered(3))
        # 绑定 工具  ===> 指标查找
        self.m_index_find.triggered.connect(lambda: self.m_tools_triggered(4))
        # 绑定 工具  ===> 合理性和增长性数据（采集）
        self.m_rational_up_cal.triggered.connect(lambda: self.m_tools_triggered(5))

    def m_tools_triggered(self, index):
        if index == 0:
            self.setCentralWidget(MEleFileSelected())
        if index == 1:
            # pass
            self.setCentralWidget(EleHouseVisitRecordsImpl())
        if index == 2:
            self.setCentralWidget(ExcelFindUserImpl())
        if index == 3:
            File_Select_Tools.select_dir(None, "选择市民化文件目录")
        if index == 4:
            self.setCentralWidget(IndexFindImpl())
        if index == 5:
            self.setCentralWidget(RationalUpCalImpl())

    def ele_situation_trigger(self):
        """
        电子记账汇总绑定函数
        :return: None
        """

        # self.setCentralWidget(MEleFileSelected())
